package cn.aeolia.Callatz;

import java.util.HashMap;
import java.util.Map;

public class Main {
    public static void main(String[] args) {
        Map<Integer, Integer> map = new HashMap<>();
        long startTime;
        long overTime;
        startTime = System.currentTimeMillis();
        A:
        for (int j = 0; j < 100000; j++) {
            int count = 0;
            int key = j, i = j;
            while (i != 1 && i != 0) {
                if (map.containsKey(i)) {
                    map.put(key, count + map.get(i));
                    break A;
                } else {
                    switch (i % 2) {
                        case 1:
                            i = (3 * i + 1) / 2;
                            break;
                        case 0:
                            i = i / 2;
                            break;
                    }
                    count++;
                }
            }
            System.out.println(count);
        }
        overTime = System.currentTimeMillis();
        System.out.println("总耗时：" + (overTime - startTime) + "ms");
    }
}


